/*
 * parseImage.cpp
 *
 *  Created on: Nov 9, 2012
 *      Author: Matthijs
 */
#include <camera/camera.h>

namespace enc = sensor_msgs::image_encodings;

/**
 *	Callback for image publication topic.
 */
void Camera::parseImageLeft (const sensor_msgs::ImageConstPtr& msg)
{
	cv_bridge::CvImagePtr cv_ptr;
	try
	{
		cv_ptr = cv_bridge::toCvCopy(msg, ""); // enc::BGR8);
		left   = cv_ptr -> image;
		findSquares(left, 1.52, false);
	}
	catch (cv_bridge::Exception& e)
	{
		ROS_ERROR("cv_bridge exception: %s", e.what());
	}
}

void Camera::parseImageRight (const sensor_msgs::ImageConstPtr& msg)
{
	cv_bridge::CvImagePtr cv_ptr;
	try
	{
		cv_ptr = cv_bridge::toCvCopy(msg, ""); // enc::BGR8);
		right  = cv_ptr -> image;
		findSquares(right, -1.52, false);
	}
	catch (cv_bridge::Exception& e)
	{
		ROS_ERROR("cv_bridge exception: %s", e.what());
	}
}
